#include "gui2.hh"

Gui2::Gui2(std::string str): m_box1{Gtk::Orientation::ORIENTATION_HORIZONTAL}, m_box2{Gtk::Orientation::ORIENTATION_HORIZONTAL}{
  this->str = str; 
  set_hierarchy();
  draw_widgets();
  show_all_children(); 
}

void Gui2::set_hierarchy(){
  add(m_fixed);

  m_fixed.add(m_frame1);
  m_fixed.add(m_frame2); 
  m_fixed.move(m_frame1, 2, 0);
  m_fixed.move(m_frame2, 2, 60); 
  
  m_frame1.add(m_alignment1);

  m_alignment1.add(m_box1); 

  m_box1.pack_start(m_label1);
  
  
  m_frame2.add(m_alignment2);

  m_alignment2.add(m_box2);

  m_box2.pack_start(m_buttonClose); 
}

void Gui2::draw_widgets(){
  set_title("Resultado");
  //set_default_size(-5, -1);
  set_visible(true);
  set_can_focus(true);
  set_resizable(false);
  set_border_width( 6 );

  //m_fixed.set_size_request(/*1, 2*/-1, -1);
  m_fixed.set_visible(true);
  m_fixed.set_can_focus(false);

  // 1 

  //  m_alignment1.set_size_request(40, 6);
  m_alignment1.set_visible( true );
  m_alignment1.set_can_focus( true );
  m_alignment1.set_border_width(10);

  m_box1.set_visible( true );
  m_box1.set_can_focus( false );

  m_frame1.set_size_request(1, 1);
  m_frame1.set_visible( true );
  m_frame1.set_can_focus( false );
  m_frame1.set_margin_end( 8 );
  m_frame1.set_shadow_type( Gtk::ShadowType::SHADOW_IN );
  m_frame1.set_label_align( 0.02 );

  m_label1.set_text(str);


  
  //  m_alignment2.set_size_request(40, 6);
  m_alignment2.set_visible( true );
  m_alignment2.set_can_focus( true );
  m_alignment2.set_border_width(10);

  m_box2.set_visible( true );
  m_box2.set_can_focus( false );

  m_frame2.set_size_request(1, 1);
  m_frame2.set_visible( true );
  m_frame2.set_can_focus( false );
  m_frame2.set_margin_end( 8 );
  m_frame2.set_shadow_type( Gtk::ShadowType::SHADOW_IN );
  m_frame2.set_label_align( 0.02 );

  
  m_buttonClose.set_label("Voltar");
  m_buttonClose.set_visible(true);
  m_buttonClose.set_can_focus(true);
  m_buttonClose.set_focus_on_click(true);
  m_buttonClose.set_border_width(5);
  m_buttonClose.signal_clicked().connect(sigc::mem_fun(*this, &Window::hide));

}
